/*
 * servermainframe.cpp
 *
 *  Created on: 2012-6-25
 *      Author: epmm
 */
#include "head.h"
#include "config.h"
#include "macro.h"
#include "config.h"
#include "tagset.h"
#include "jobbase.h"
#include "threadmutex.h"
#include "threadcondition.h"
#include "worktask.h"
#include "socketbase.h"
#include "socketselect.h"
#include "socketclient.h"
#include "protocolparse.h"
#include "threadpool.h"
#include "mainframe.h"

IMPLEMENT_DYNAMIC(CMainframe, CObject)

CMainframe::CMainframe()
{
	// TODO Auto-generated constructor stub

}

CMainframe::~CMainframe()
{
	// TODO Auto-generated destructor stub
}

int CMainframe::InitSys(int argc, char **argv)
{
	return PUB_OK;
}

int CMainframe::InitLog()
{
	return PUB_OK;
}

int CMainframe::InitDB()
{
	return PUB_OK;
}

int CMainframe::InitConfig(const char* cfgfile)
{
	return PUB_OK;
}

int CMainframe::InitMsg()
{
	return PUB_OK;
}

int CMainframe::InitSocket()
{
	return PUB_OK;
}

int CMainframe::process()
{
	return PUB_OK;
}

int CMainframe::process(const char* pReqstr, string& Response)
{
	return PUB_OK;
}


int CMainframe::ParseDBStr(const char* sSrc, string& user, string& pwd,
		string& service_name)
{
	char sBuf[128] = { 0 };
	char* psToken = NULL;

	strncpy(sBuf, sSrc, 128);

	psToken = strtok(sBuf, "/@");
	if (psToken == NULL)
	{
		return PUB_ERROR;
	}
	user = psToken;

	psToken = strtok(NULL, "/@");
	if (psToken == NULL)
	{
		return PUB_ERROR;
	}
	pwd = psToken;

	psToken = strtok(NULL, "/@");
	if (psToken == NULL)
	{
		return PUB_ERROR;
	}
	service_name = psToken;

	return PUB_OK;
}


